#Copyright 2003, Cypress Semiconductor Corporation

#*****************************************************************************#

#This software is owned by Cypress Semiconductor Corporation (Cypress) and is

#protected by United States copyright laws and international treaty provisions.

#Cypress hereby grants to Licensee a personal, non-exclusive, non-transferable 

#license to copy, use, modify, create derivative works of, and compile the 

#Cypress Source Code and derivative works for the sole purpose of creating 

#custom software in support of Licensee product ("Licensee Product") to be 

#used only in conjunction with a Cypress integrated circuit. Any reproduction, 

#modification, translation, compilation, or representation of this software 

#except as specified above is prohibited without the express written permission

#of Cypress.





#Disclaimer: Cypress makes no warranty of any kind, express or implied, with 

#regard to this material, including, but not limited to, the implied warranties

#of merchantability and fitness for a particular purpose. Cypress reserves the 

#right to make changes without further notice to the materials described 

#herein. Cypress does not assume any liability arising out of the application 

#or use of any product or circuit described herein. Cypress products described

# herein are not authorized for use as components in life-support devices.

#This software is protected by and subject to worldwide patent coverage, 

#including U.S. and foreign patents. Use may be limited by and subject to 

#the Cypress Software License Agreement.

#*****************************************************************************#



#Source File Information Header Template

# *******************************************************************

# File : 

# Author :Prokash Ghosh 

# Author s Email:pbg@cypress.com

# Date : 30 AUG,03 

# Revision : 1.1  

# *******************************************************************

# Description : This script is to run the verilog model simualtion with NC_Verilog Simulator.

# (Add succinct functionality description here.)

#

# *******************************************************************

#!/bin/csh 

##############################################################################

# Cypress Semiconductor Confidential. Copyright 2001, All Rights reserved    #

# Permission to use, modify or copy this code is prohibited without the      #

# express written consent of Cypress Semiconductor.                          #

# 110 Nortech Parkway, San Jose, CA 95134                                    #

#                                                                            #

# Author: pbg@cypress.com                                                    #

# $Date: 28/05/03 #                                                          #

# $Revision: 1.0 $ #                                                         #

##############################################################################

set m = `echo $1 | cut -d"." -f1`

set optfile = ""

set p = `pwd`

set model_dir = $p/../../Verilog/model

set run_dir   = $p/../../Verilog/run

set rpt_dir = $p/../../Verilog/rpt

set tb_dir = $p/../../Verilog/tb

#############################Clear the RPT directory #######################

if("$2" != "8") then

cd $rpt_dir

echo "Do you want to remove log and VCD files(Y/N) from rpt directory : Default is No "

echo "Enter an Option: "

set resp5 = $<

if(("$resp5" == "Y") || ("$resp5" == "y")) then

\rm -rf *.vcd 

\rm -rf *.log

\rm -rf *.trn

\rm -rf *.dsn

endif

cd $tb_dir

\rm -rf *.log

##############################DUMP ON ###############################

echo "Do you want to generate VCD file(Y/N): Default is No  "

echo "Enter an Option:"

        set response1 = $<

if(("$response1" == "Y") || ("$response1" == "y")) then

    set  optfile = "${optfile}+DUMPON"

endif

#####################################################################

echo "Do you want to turn on the DEBUG MODE(Y/N) : Default is No "

set resp6 = $<

if (("$resp6" == "Y") || ("$resp6" == "y")) then

echo " Answer the following questions : "

echo " Do you want to turn on TIMING MONITOR(Y/N) : Default is No"

set resp1 = $<

if(("$resp1" == "Y") || ("$resp1" == "y")) then

set optfile = "${optfile}+TMS"

endif #TMS



echo " Do you want to turn  on UNKNOWN HANDLER(Y/N) : Default is No"

set resp2 = $<

if(("$resp1" == "Y") || ("$resp1" == "y")) then

set optfile = "${optfile}+XMS"

endif # XMS



echo " Do you want to turn on Operation Related Message(Y/N) : Default is No"

set resp3 = $<

if(("$resp3" == "Y") || ("$resp3" == "y")) then

set optfile = "${optfile}+OMS"

endif # OMS



endif #DEBUG mode

####################################################################

if ("$optfile" == "") then

;

else

set optfile = "+define$optfile" 

endif

##run the simulation

##echo SIMULATION STARTED AT `date`  >>$run_dir/cmd

echo " cd $tb_dir" >>$run_dir/cmd

echo "ncverilog ${optfile} $tb_dir/$1 +access+r | tee  $rpt_dir/$m.log;" >>$run_dir/cmd

ncverilog ${optfile} $1 +access+r | tee  $m.log;

echo "cd $run_dir" >>$run_dir/cmd

##echo SIMULATION ENDED AT `date`  >>$run_dir/cmd

\rm -rf run_default

mv $run_dir/cmd $run_dir/run_default

chmod 755 $run_dir/run_default

mv $m.log $rpt_dir/

mv verilog.vcd $rpt_dir/$m.vcd

\rm -rf *.log

cd $rpt_dir

###################################################################

set s1 = `grep -n PASS $m.log | wc -l`

echo "The testcase = $m"

echo " TOTAL PASS= $s1"

set s2 = `grep -n FAIL $m.log | wc -l`

echo " TOTAL FAIL = $s2"

if (($s2 == 0 ) && ($s1 > 0)) then

echo " Test $m is PASSED "

else if (($s2 == 0)  && ($s1 == 0))  then

echo " Test $m is not simulated "

else

echo "Test $m is FAILED"

endif

cd $run_dir

else  #response_vxl == 8

cd $tb_dir

if(( "$3" == "y") || ( "$3" == "Y")) then 

set  optfile = "${optfile}+DUMPON"

endif

if ("$optfile" == "") then

;

else

set optfile = "+define$optfile" 

endif

##echo SIMULATION STARTED AT `date`  >>$run_dir/cmd

echo " cd $tb_dir" >>$run_dir/cmd

echo "ncverilog ${optfile} $tb_dir/$1 +access+r | tee  $rpt_dir/$m.log;" >>$run_dir/cmd

ncverilog ${optfile} $1 +access+r | tee  $m.log;

echo "cd $run_dir" >>$run_dir/cmd

##echo SIMULATION ENDED AT `date`  >>$run_dir/cmd

\rm -rf run_default

mv $run_dir/cmd $run_dir/run_default

chmod 755 $run_dir/run_default

mv verilog.vcd $rpt_dir/$m.vcd

mv $m.log $rpt_dir/

\rm -rf *.log

endif

cd $run_dir

exit



